package ${package.Entity};

<#list table.importPackages as pkg>
    import ${pkg};
</#list>

<#if entityLombokModel>
    import lombok.Getter;
    import lombok.Setter;
    import java.io.Serializable;
    import io.swagger.v3.oas.annotations.media.Schema;
</#if>



/**
* ${table.comment!"${entity} Entity"}
*/
<#if entityLombokModel>
    @Getter
    @Setter
</#if>

<#if table.convert>
    @TableName("${table.name}")
</#if>

<#if table.comment??>
    @Schema(description = "${table.comment}")
</#if>

<#if superEntityClass??>
    public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
    public class ${entity} extends Model<${entity}> {
<#else>
    public class ${entity} implements Serializable {
</#if>

<#if entitySerialVersionUID>
    private static final long serialVersionUID = 1L;
</#if>

<#-- ========== 字段循环开始 ========== -->
<#list table.fields as field>
    <#if field.comment?? && field.comment != "">
        @Schema(description = "${field.comment}")
    </#if>

<#-- 主键处理 -->
    <#if field.keyFlag>
        <#if field.keyIdentityFlag>
            @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
        <#elseif idType??>
            @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
        <#else>
            @TableId("${field.annotationColumnName}")
        </#if>
    <#-- 自动填充字段 -->
    <#elseif field.fill??>
        <#if field.convert>
            @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
        <#else>
            @TableField(fill = FieldFill.${field.fill})
        </#if>
    <#-- 普通字段 -->
    <#elseif field.convert>
        @TableField("${field.annotationColumnName}")
    </#if>
    private ${field.propertyType} ${field.propertyName};

</#list>
<#-- ========== 字段循环结束 ========== -->

}
